package l.l.w.practice.ExactDivisionBy4;

/**
 * Created by llw on 2017/10/2.
 */
public class ExactDivisionBy4 {
    public boolean test(int[] nums){
        int a=0,b=0,c=0;
        for(int i = 0; i < nums.length;++i){
            if((nums[i] & 1) ==1){//奇数
                c++;
            }else if(nums[i]%4==0){//能被四整除
                a++;
            }else{  //偶数
                b++;
            }
        }
        if(a==0){
            if(c!=0) return false;
            else if(b==1){
                return false;
            }return true;
        }
        if(c<a+1){
            return true;
        }else if(c==a+1){
            if(b==0)return true;
            return false;
        }else{
            return false;
        }
    }
}
